﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;


namespace OrderManagementForm
{
    public partial class Form2 : Form
    {
       
        public Form2()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            //获取各个输入文本框里面的内容
            int id = Convert.ToInt32(textBox1.Text);
            string customer = textBox2.Text;
            string goods = textBox3.Text;
            double money = Convert.ToDouble(textBox4.Text);
            double price = Convert.ToDouble(textBox5.Text);
            double amount = Convert.ToDouble(textBox6.Text);

            //添加订单
            OrderManagement.order aaa = new OrderManagement.order(id, customer, goods, money);
            OrderManagement.Order.Add(aaa);
            //添加订单详细
            OrderManagement.orderitem bbb=new OrderManagement.orderitem(id, customer, goods, money,price,amount);
            OrderManagement.OrderItem.Add(bbb);
            MessageBox.Show("你添加的的订单内容为：\n 订单号：" + bbb.id + " 客户：" +
                            bbb.customer + " 商品名称：" + bbb.goods + " 单价：" + bbb.price + " 数目：" + bbb.amount
                            + "  金额：" + bbb.price * bbb.amount);
            //回到主界面
            Form1 f1 = new Form1();
            this.Hide();
            f1.ShowDialog();
            this.Dispose();
        }
        
      
    }
}
